<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="description" content="">
  <meta name="keywords" content="">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
  <title>欢迎登录使用</title>

  <!-- Set render engine for 360 browser -->
  <meta name="renderer" content="webkit">

  <!-- No Baidu Siteapp-->
  <meta http-equiv="Cache-Control" content="no-siteapp"/>

  <link rel="icon" type="image/png" href="images/favicon.png">

  <script src="../public/all/js/jquery-3.1.1.min.js"></script>
  <script src="../public/all/js/amazeui.min.js"></script>
  <script src="../public/all/js/jquery.cookie.js"></script>
  <script src="js/login.min.js"></script>

  <!-- debug only -->
  <script src="js/spin.min.js"></script>
  <script src="js/loading.js"></script>
  <script src="../public/all/js/context.js"></script>
  <script src="../public/all/js/util.js"></script>
  <script src="../public/all/js/cmd.js"></script>
  <script src="../public/all/js/classify.js"></script>

  <script src="../public/all/js/me.js"></script>
  <!-- debug only end -->
  
  <link rel="stylesheet" href="../public/all/css/amazeui.min.css">
  <link rel="stylesheet" href="css/login.css">
  <link rel="stylesheet" href="css/phone.css">
</head>
<body>
  <div class="body-bg"><img src="images/bg2.jpg"></div>

  <div id="login-top">
      欢迎登录使用
      <i class="am-icon-chevron-left2 back"></i>
  </div>
  <div id="login-content">
      <div class="list">
        <div class="item item-input account">
            <img src="images/icon-user.png">
            <span>帐&nbsp;&nbsp;&nbsp;号&nbsp;:&nbsp;</span>
            <div class="input">
                <input class="reset-field ng-pristine ng-valid ng-not-empty ng-valid-required ng-touched" 
                    name="userName" type="text" autocomplete="off">
            </div>
        </div>
        <div class="item item-input password">
            <img src="images/icon-pwd.png">
            <span>密&nbsp;&nbsp;&nbsp;码&nbsp;:&nbsp;</span>
            <div class="input">
                <input class="reset-field ng-pristine ng-valid ng-not-empty ng-valid-required ng-touched" 
                    name="password" type="password" autocomplete="off">
            </div>
            <i class="icon icon-close ng-hide"></i>

        </div>
        <p class="clue">验证码错误，请重新输入</p>

        <button class="button button-block button-positive button-disable" type="submit">登录</button>
      </div>

      <table id="login-href"><tr>
        <td><a href="#" class="register">马上注册</a></td>
        <td><a href="#" class="try">免费试玩</a></td>
        <td><a href="../qgc/index.html" class="pc">电脑版</a></td>
    </tr></table>
  </div>

  <div id="loading"></div>
</body>
</html>

<script>
    var f = function() {
        var account = $('input[name="userName"]').val().trim();
        var p = $('input[name="password"]').val().trim();
        if (account && p)  {
            $(".button").removeClass("button-disable");
            return true;
        }
        else {
            $(".button").addClass("button-disable");
            return false;
        }
    }
    $('.input input').bind('input propertychange', function(){  
        f();
    });
    f();

    $(".button").click(function() {
        if (!f()) return;
        var account = $('input[name="userName"]').val().trim();
        var p = $('input[name="password"]').val().trim();
        $("p.clue").hide();

        startSpin();
        urlInfo.params.try = 0;
        CMD.signin(account, p, "phone", function(r) {
            console.log("登录成功", r.data);
            stopSpin();
            Util.jumpUrl({
                file: "index.html",
                notice: 1,
                try: 0,
            });
        }, function(message) {
            stopSpin();
            $("p.clue").show();
            $("p.clue").html(message || '登录认证失败！');
        });
    });

    $("#login-top i").click(function() {
        Util.jumpUrl({
            file: "index.html"
        });
    });
    $("a.register").click(function() {
        Util.jumpUrl({
            file: "register.html"
        });
    });
    $("a.try").click(function() {
        urlInfo.params.try = 1;
        startSpin();
        CMD.trial(function(r) {
            stopSpin();
            Util.jumpUrl({
                file: 'index.html',
                try: 1,
            });
        });
    });

    $(".password .icon").click(function(e) {
        var t = $(e.currentTarget);
        if (t.attr("class").indexOf("icon-close") != -1) {
            t.removeClass("icon-close");
            t.addClass("icon-open");
            $("input[name='password']").attr("type", "text");
        }
        else {
            t.removeClass("icon-open");
            t.addClass("icon-close");
            $("input[name='password']").attr("type", "password");
        }
    });

    function alert2(message) {
        $("#clue_content").html(message);
        $("#clue").modal({
            width: 250
        });

        // 延迟3秒关闭
        setTimeout(function() {
            $("#clue").modal("close");
        }, 2000);
    }
</script>